<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script language="javascript" src="js/jquery-1.4.2.min.js"></script>
<script language="javascript" src="js/jquery.checkboxes.min.js"></script>
<script language="javascript" src="js/tableRowCheckboxToggle.js"></script>
<script>
$(document).ready(function(){
		//点击事件切换 全选取消状态
		$("#selectall").click( function (){ $("#grouplist").toggleCheckboxes(); });
	});
</script>
<title>列表</title>
</head>

<body>
<div id="man_zone">
<?php if($action=="add"){ ?>

  <form method="post" action="?action=add">
    <table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
      <tr>
        <td align="right"  class="left_title_1">分类名称：</td>
        <td align="left"><input name="cityname" type="text" id="cityname" /></td>
      </tr>
      <tr>
        <td align="right"  class="left_title_1">是否设置默认：</td>
        <td align="left"><label>
          <input type="radio" name="default" value="1" />
          是
          <input name="default" type="radio" value="0" checked="checked" /> 
          否
</label></td>
      </tr>
    <tr>
      <td width="11%"  class="left_title_2">	</td>
      <td width="89%" align="left"><input name="Submit" type="submit" id="Submit" value="提交" /></td>
    </tr>
  </table>
  </form>
 <?php }elseif($action=="edit"){ ?>

  <form method="post" action="?action=edit">
  <input name="cid" type="hidden" id="cid" value="<?php echo $value['cid'];?>" />
    <table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
      <tr>
        <td align="right"  class="left_title_1">分类名称：</td>
        <td align="left"><input name="cityname" type="text" id="cityname" value="<?php echo $value['cityname'];?>" /></td>
      </tr>
    <tr>
      <td width="11%"  class="left_title_2">	</td>
      <td width="89%" align="left"><input name="Submit" type="submit" id="Submit" value="提交" /></td>
    </tr>
  </table>
  </form>
<?php }elseif(empty($action)){ ?>


  <table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
      <td>
	    
    <input type="button" onclick="grouplist.submit();" name="Submit" value="删除选定" />
    <input type="button" onclick="location.href='city_manage.php?action=add'" name="Submit2" value="添加地区" /></td>
      <td width="62%" align="right">&nbsp;</td>
    </tr>
  </table>
  
<form method="post" action="?action=dels" name="grouplist" id="grouplist">
  <table width="99%" align="center"  border="0" cellpadding="3" cellspacing="1" class="table_style">
    <tr>
      <th width="2%"><label>
        <input type="checkbox" name="checkbox" value="checkbox" id="selectall" />
      </label></th>
      <th width="4%">编号</th>
      <th width="61%">地区名称</th>
      <th width="9%">默认</th>
      <th width="9%">状态</th>
      <th width="15%">操作</th>
    </tr>
	<?php if(is_array($dataarray)){foreach($dataarray as $value){?>
    <tr class="odd_row">
      <td align="center"><input type="checkbox" name="delids[]" value="<?php echo $value['cid']?>" /></td>
      <td><?php echo $value['cid']?></td>
      <td><?php echo $value['cityname']?></td>
      <td><?php if($value['def']==1)echo "√";else echo "×";?>&nbsp;</td>
      <td><?php if($value['state']==1)echo "√";else echo "×";?>&nbsp;</td>
      <td>
	  <?php if($value['state']==1){?>
	  <a href="city_manage.php?action=lose&amp;cid=<?php echo $value['cid']?>"><font color="#FF0000">禁用</a>
	  <?php }elseif($value['state']==0){ ?>
	  <a href="city_manage.php?action=check&amp;cid=<?php echo $value['cid']?>"><font color="#006633">恢复</font></a>
	  <?php };?>
	  |
	  <?php if($value['def']==0){?>
	  <a href="city_manage.php?action=setdef&amp;cid=<?php echo $value['cid']?>"><font color="#FF0000">设置默认</a>
	  <?php }elseif($value['def']==1){ ?>
	  <a href="city_manage.php?action=cleardef&amp;cid=<?php echo $value['cid']?>"><font color="#006633">取消默认</font></a>
	  <?php };?>
	  
	  
	  
	  |<a href="city_manage.php?action=edit&amp;cid=<?php echo $value['cid']?>">编辑</a>|<a href="javascript:if(confirm('确实要删除吗?'))location='city_manage.php?action=del&cid=<?php echo $value['cid']?>'">删除</a></td>
    </tr>
	<?php }}else{?>
	<tr><td colspan=6>暂无数据..............</td></tr>
	<?php };?>
  </table>
  
  <div style="width:99%;margin:0px auto;">

  
    <?php echo multi($total,$pagesize,$page,"");?>
  </div>
  </form>
  
  <?php }?>
</div>
</body>
</html>
